package com.sxs.dao;

import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Repository
// 持久层
public class MenuDao implements MenuDaoInterface {
	Logger logger = Logger.getLogger(MenuDao.class);
	@Autowired
	private JdbcTemplate jdbcTemplatePer;

	@Override
	public List<Map<String, Object>> getCreateFatherMenu() {
		String sql = "select id,unitName from per_unit";
		List<Map<String, Object>> list = jdbcTemplatePer.queryForList(sql);
		return list;
	}

	@Override
	public List<Map<String, Object>> getFatherMenu() {
		String sql = "select * from per_department where deptParent=0";
		List<Map<String, Object>> list = jdbcTemplatePer.queryForList(sql);
		return list;
	}


	@Override
	public List<Map<String, Object>> getCreateMenuChild(String parentCode) {
		String sql = "select * from per_department where deptParent='"+parentCode+"'";
		List<Map<String, Object>> list = jdbcTemplatePer.queryForList(sql);
		return list;
	}

}
